# !/usr/bin/python
# _*_ coding: utf-8 _*_
# @Time : 2021/5/22 5:39 下午
# @Author : liujun
# @File : prod_config.py
# @desc : 生产环境配置文件
import secrets
from typing import List
from pydantic import BaseSettings


from utils.cnf_utils import MyCnf


# 获取MySQL连接信息
mysql_datasource = MyCnf().get_content('datasource_prod')


class Settings(BaseSettings):
    # 项目名称
    TITLE: str = 'FastApi_Blog_Server'
    # api版本
    API_V1_STR: str = '/api/v1'
    # 跨域设置
    BACKEND_CORS_ORIGINS: List = ['*']
    # 数据库连接信息
    SQLALCHEMY_DATABASE_URI: str = 'mysql+pymysql://%(user)s:%(password)s@%(host)s:%(port)s/%(db)s' % mysql_datasource
    # 秘钥
    SECRET_KEY: str = secrets.token_urlsafe(32)
    # token过期时间
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8


settings = Settings()
